home *** CD-ROM | disk | FTP | other *** search
- Path: uhura.phoenix.net!usenet
- From: brucew@phoenix.net (Bruce Wedding)
- Newsgroups: comp.lang.c
- Subject: Re: accessing structures via pointers
- Date: Tue, 09 Apr 1996 03:50:52 GMT
- Organization: BranPaul Systems
- Message-ID: <4kcn32$564@uhura.phoenix.net>
- References: <1996Apr8.144012.25767@leeds.ac.uk>
- NNTP-Posting-Host: dial89.phoenix.net
- X-Newsreader: Moe's Newsreader
-
- In comp.lang.c
- csyamc@scs.leeds.ac.uk (A M Casey) wrote:
-
- > struct group {
- > char *gr_name; /* the name of the group */
- > char *gr_passwd; /* the encrypted group password */
- > gid_t gr_gid; /* the numerical group ID */
- > char **gr_mem; /* vector of pointers to member names */
- > };
-
- I assume the function is allocating memory for these strings?
-
- >printf("the group name is %s\n",tempgroup.gr_name);
-
- Try it like this:
-
- printf("the group name is %s\n",tempgroup->gr_name);
-
- which is an easier way than doing this:
-
- printf("the group name is %s\n",*(tempgroup).gr_name);
-
-
-
-
-
-